package com.util;

import java.util.concurrent.*;

public class ThreadManager {

    public static ExecutorService executorService = new ThreadPoolExecutor(1, 10000,
            60L, TimeUnit.SECONDS,
            new SynchronousQueue<>(),
            ((r, executor) ->{
                    if (!executor.isShutdown()) {
                        //直接执行run方法
                        r.run();
                        System.out.println("bbb");
                    }
                }
            )

            );

    public static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1,
            Executors.defaultThreadFactory()
            ,
            ((r, executor) ->{
                if (!executor.isShutdown()) {
                    //直接执行run方法
                    r.run();
                }
             }
            )
    );
}
